<!DOCTYPE html>
<html lang="en" style="overflow:hidden;">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
	<title></title>
  <link rel="stylesheet" type="text/css" href="/assets/activity/fangjinsuo/css/main.css">
  <link rel="stylesheet" type="text/css" href="/assets/activity/fangjinsuo/css/style.css">
  <script src="/assets/activity/fangjinsuo/js/zepto.min.js"></script>
  <script src="/assets/activity/fangjinsuo/js/flexible.js"></script>
  <style type="text/css">
  	body{padding-bottom:50px;}
  </style>
</head>
<body>
<!-- <div class="header">
	<a href="/"><img class="logo" src="" alt=""></a>
	<div class="tel-phone">贷款热线：4008-102-999</div>
</div>
 -->  <div class="feature">
    <p class="intro">个人房产，按揭房，商铺，企业经营统统都能贷！</p>
    <p class="intro">额度高达</p>
    <p class="num">5000 <span class="">万</span></p>
    <div class="yafang">不押房，照常住</div>
      <ul>
        <li><span class="round blue-round"><div>24小时<br>快速放款</div></span></li>
        <li><span class="round green-round"><div>0.5% <br>月息低至</div></span></li>
        <li><span class="round yellow-round"><div>80%<br>可贷额度</div></span></li>
      </ul>
    </div>
  </div>
  <div class="ui-form apply-form" id="fixed-form">
     <!-- <form onsubmit="" name="msg-verify" class="no_imagecode"> -->
       <div class="ui-form-item ui-form-item-r">
         <div class="gender-box">
           <label class="name">有无房产</label>
           <label class="gender-item active">
            <input name="fruit" class="fruit" type="radio" value="1"  checked />
            <span>有</span>
           </label>
           <label class="gender-item ">
            <input name="fruit" class="fruit" type="radio" value="2"/>
            <span>无</span>
           </label>
          </div>
       </div>
       <div class="ui-form-item ui-form-item-r">
         <label>手机号码</label>
         <div class="ui-input">
             <input type="tel" name="phone" id="phone" placeholder="输入您的手机号" class="ui-text" maxlength="11">
         </div>
       </div>
       <div class="ui-form-item ui-form-item-r">
         <label>验证码</label>
         <div class="ui-input">
          <input type="tel" name="code" id="code" placeholder="输入验证码" class="ui-text" maxlength="6">
         </div>
         <!-- 若按钮不可点击则添加 disabled 类 -->
         <input type="button" value="获取验证码" class="verify-msg able" id="getMsg">
      </div>
       <input type="hidden" name="need_type" value="房产抵押贷款">
       <div class="error-box" id="divid" style="display:none ;"></div>
       <div class="ui-form-item ui-form-item-bottom">
          <button type="submit" id="sub" class="ui-submit-btn">提交申请</button>
       </div>
    <!-- </form> -->
   </div>
	<div class="background" style="display:none;position: fixed;top: 0;left: 0;right: 0;bottom: 0;background: rgba(0,0,0,.20);">
      <div class="box" style="width: 250px;padding: 20px;position: absolute;top: 50%;left:50%;transform: translate(-50%,-50%);background: #fff;text-align: center;box-shadow: 0px 0px 5px 1px rgba(0,0,0,.4)">
        <p id="warning-box" style="font-size: 14px"></p>
        <button id="sure" style="background: green;color: #fff;padding:10px;margin-top: 20px;width: 100%;font-size: 16px;border-radius: 5px">确定</button>
      </div>
    </div>
<script>
	$('.gender-item').on("touchend",function(){
    	// console.log(111)
   		$(this).toggleClass('active')
    	$(this).siblings('.gender-item').toggleClass('active')
  	})
  	// 获取验证码
  	$(document).on("touchend",'#getMsg.able',function(){
		var phone = $("#phone").val();
  		$.getJSON("/activity/ajaxSendCode",{mobile:phone},function(logJson) {
            if (logJson.status == 'ok') {
                alert("验证码发送成功");
            }else{
                alert(logJson.status);
            }
        });
	    $(this).val("发送中...").removeClass('able')
	    setTimeout(time,1000)
	  })
	function time(){
	    var time = 60
	    var countDown = setInterval(fun,1000)
	    function fun(){
	      --time
	      $('#getMsg').val(time+'后重新发送')
	      if (time == 0) {
	        clearInterval(countDown)
	        $('#getMsg').val('获取验证码').addClass('able')
	      }
	    }
	  }
	 $("#sure").on("touchend",function(){
	 	$(".background").hide();
	 });
  	// 提交
  	$("#sub").on("touchend",function(){
  		var phone = $("#phone").val();
    	var code = $("#code").val();
    	var nums = $(".gender-item.active").children(".fruit").val();
        // alert(nums);return false;
        var myreg = /^((\d{3}-\d{8}|\d{4}-\d{7,8})|(1[3|5|7|8][0-9]{9}))$/;
		if (phone=="") {
			alert('手机号码不能为空');
			return false;
		}
		if (nums=="") {
			alert('参与人数不能为空');
			return false;
		}
		if(!myreg.test(phone)){
			alert("手机号格式不正确");
			return false;
		}
        var URL="/activity/subFangjinsuo";
        $.ajax({
           type: "get",
           url: URL,
           dataType:'json',
           data: {
        	   'code':code,
        	   'phone':phone,
        	   'nums':nums,
        	   },
           success: function(data){
        	 // alert(data);return false;
             if(data.code== 200){
            	 // alert(data.msg);
            	 $("#warning-box").html(data.msg);
            	 $(".background").show();
             }else{
            	 $("#warning-box").html(data.msg);
            	 $(".background").show();
             }
           }
      });
});
 </script>
</body>
</html>